package _15_generics._15_7;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * 创建泛型数据
 */
public class _07_ArrayMaker<T> {
    private Class<T> kind;

    public _07_ArrayMaker(Class<T> kind){
        this.kind = kind;
    }

    T[] create(int size){
        return (T[]) Array.newInstance(kind,size);
    }

    public static void main(String[] args) {
        _07_ArrayMaker<String> stringMaker = new _07_ArrayMaker<>(String.class);
        System.out.println(Arrays.toString(stringMaker.create(2)));
    }

}
